package com.jstyle.jclife.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;

import com.jstyle.jclife.R;
import com.jstyle.jclife.adapter.TeamAdapter;
import com.jstyle.jclife.model.TeamInfoDetail;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class TeamPKActivity extends BaseActivity{
    @BindView(R.id.title)
    Button title;

    @BindView(R.id.teampk_RecyclerView)
    RecyclerView teampk_RecyclerView;

    TeamAdapter teamAdapter;
    String titile="3";//默认为3公里pk赛
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_teampk);
        ButterKnife.bind(this);
        if(null!=getIntent()&&!TextUtils.isEmpty(getIntent().getStringExtra("titile"))){
            titile=getIntent().getStringExtra("titile");
            title.setText(titile+getResources().getString(R.string.pksai));
        }



        teampk_RecyclerView.setLayoutManager(new LinearLayoutManager(this));
        teamAdapter=new TeamAdapter();
        teampk_RecyclerView.setAdapter(teamAdapter);
        //添加假数据
        List<TeamInfoDetail> sleepDetails=new ArrayList<>();
        TeamInfoDetail tt=new TeamInfoDetail();
        tt.setId(0);
        tt.setTeamname("友宏战队");
        tt.setIsinjonin(true);
        TeamInfoDetail aa=new TeamInfoDetail();
        aa.setId(1);
        aa.setTeamname("南京战队");
        aa.setIsinjonin(false);
        TeamInfoDetail bb=new TeamInfoDetail();
        bb.setId(2);
        bb.setTeamname("新加坡战队");
        bb.setIsinjonin(false);
        sleepDetails.add(tt);
        sleepDetails.add(aa);
        sleepDetails.add(bb);
        teamAdapter.setData(sleepDetails);

    }

    @OnClick({R.id.iv_back})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;


        }
    }
}
